//
//  MPDownloader.h
//  MissPaparazzi
//
//  Created by Alexey Aleshkov on 10.09.12.
//  Copyright (c) 2012 DzeTech. All rights reserved.
//


#import <Foundation/Foundation.h>
#import "AFNetworking.h"


typedef void(^MPDownloaderProgressBlock)(NSString *URLString, UInt64 readBytes, UInt64 totalBytes);
typedef void(^MPDownloaderSuccessBlock)(NSString *URLString, NSString *targetPath);
typedef void(^MPDownloaderFailureBlock)(NSString *URLString, NSString *targetPath, NSError *error);



@interface MPDownloader : NSObject
{
	NSMutableArray *_pausedRequests;
	NSMutableArray *_processingRequests;
    AFHTTPClient *_client;
}

- (id)initWithBaseURL:(NSURL *)URL;

- (void)downloadFile:(NSString *)URLString toPath:(NSString *)path successBlock:(MPDownloaderSuccessBlock)successBlock failureBlock:(MPDownloaderFailureBlock)failureBlock progressBlock:(MPDownloaderProgressBlock)progressBlock;
- (void)pause:(NSString *)URLString;
- (void)pauseAll;
- (void)resume:(NSString *)URLString;
- (void)resumeAll;
- (void)cancel:(NSString *)URLString;
- (void)cancelAll;

@end
